package com.leyou.page.config;

import com.leyou.common.auth.RsaUtils;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.security.PublicKey;

/**
 * 读取jwt参数
 */
@Data
@Component
@ConfigurationProperties(prefix = "ly.jwt")
public class JwtProperties {

    private String pubKeyPath;

    private PublicKey publicKey;

    @PostConstruct // 代表初始化方法
    public void initMethod() throws Exception {
        publicKey = RsaUtils.getPublicKey(pubKeyPath);
    }

    private CookiePojo cookie = new CookiePojo();

    private AppPojo app = new AppPojo();
    @Data
    public class CookiePojo{
        private String cookieName;//cookie名称
    }

    @Data
    public class AppPojo{
        private String serviceName;
        private String secret;
    }
}
